#{extends '/templates/admin/admin-index.html'/}

#{set title:'功能列表' /}
#{set 'moreScripts'}
<script src="/tts/public/admin/sys/role.js"></script>
#{/set}
<div id="app" v-cloak>

<!-- 数据列表 -->
    <h2 class="alert alert-danger text-center" v-show="errorShow">{{"系统提示："+errorMsg}}</h2>
    <div v-show="showList">
        <div class="panel panel-primary">
            <div class="panel-heading">
                <h3 class="panel-title">查询</h3>
            </div>
            <div class="panel-body">
                <div class="form-horizontal">
                    <div class="form-group">
                        <label for="name" class="col-sm-1 control-label">角色名称</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" id="name" placeholder="角色名称" v-model="q.name">
                        </div>
                        <label for="remark" class="col-sm-1 control-label">角色简介</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" id="remark" placeholder="角色简介" v-model="q.remark">
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-12 text-center">
                            <a class="btn btn-primary " @click="search">查询</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="grid-btn">
            <a class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a>
            <a class="btn btn-primary" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
            <a class="btn btn-primary" @click="invalid"><i class="fa fa-trash-o"></i>&nbsp;禁用</a>
            <a class="btn btn-primary" @click="valid"><i class="fa fa-bookmark-o"></i>&nbsp;启用</a>
        </div>
        <table id="jqGrid"></table>
        <div id="jqGridPager"></div>
    </div>

<!-- 新增表单 -->
    <div v-show="!showList" class="panel panel-default">
        <div class="panel-heading">{{title}}</div>
        <form class="form-horizontal">
            <div class="form-group">
                <div class="col-sm-2 control-label">角色名称</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" v-model="role.name" placeholder="角色名称"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">角色简介</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" v-model="role.remark" placeholder="角色简介"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">角色授权</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control"  placeholder="角色授权" v-model="menuNames" @click="menuTree" readonly/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label"></div>
                <input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定"/>
                &nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
            </div>
        </form>
    </div>
</div>

<!-- 选择菜单 -->
<div id="menuLayer" style="display: none;padding:10px;">
    <ul id="menuTree" class="ztree"></ul>
</div>

